//
//  MusicViewController.m
//  海角音乐
//
//  Created by dllo on 15/8/4.
//  Copyright (c) 2015年 杨元石. All rights reserved.
//

#import "MusicViewController.h"



@interface MusicViewController ()

@end

@implementation MusicViewController

- (void)viewDidLoad {
    [super viewDidLoad];    
    

    
    _musicView = [[MusicView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    _musicView.collectionView.dataSource = self;
    _musicView.collectionView.delegate = self;
    [self.view addSubview:_musicView];
    [_musicView.collectionView registerClass:[MusicCollectionViewCell class] forCellWithReuseIdentifier:@"reuseld"];
    
    _titleArr = @[@"新歌首发", @"排行", @"歌手", @"MV", @"分类", @"大家在听"];
   
    _imageForCell = @[@"1", @"2", @"3", @"4", @"6", @"5"];
    
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
  
    return 6;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    static NSString *reuseID = @"reuseld";
    MusicCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseID forIndexPath:indexPath];
    cell.label.text = [_titleArr objectAtIndex:indexPath.row];
    cell.imageView.image = [UIImage imageNamed:[_imageForCell objectAtIndex:indexPath.row]];    
    return cell;
}


-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (indexPath.row == 1) {
        
        RankViewController *rankVc = [[[RankViewController alloc] init] autorelease];
        [self.navigationController pushViewController:rankVc animated:YES];
        
    } else if (indexPath.row == 2) {
        
        SingerViewController *singerVc = [[[SingerViewController alloc] init] autorelease];
        [self.navigationController pushViewController:singerVc animated:YES];
        
    } else if (indexPath.row == 3){
        
        MvViewController *mvVc = [[[MvViewController alloc] init] autorelease];
        [self.navigationController pushViewController:mvVc animated:YES];
        
    } else if (indexPath.row == 0) {
        
        NewsSongsViewController *newsSongsVc = [[[NewsSongsViewController alloc] init] autorelease];        
        [self.navigationController pushViewController:newsSongsVc animated:YES];
        
        
    } else if (indexPath.row == 4) {
        
        CategoryViewController *cateVc = [[[CategoryViewController alloc] init] autorelease];
        [self.navigationController pushViewController:cateVc animated:YES];
        
    } else {
        
        PeopleListenViewController *peopleVc = [[[PeopleListenViewController alloc] init] autorelease];
        [self.navigationController pushViewController:peopleVc animated:YES];
    }
    
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
